<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Title</title>
  <link rel="stylesheet" href="../static/bootstrap/css/bootstrap.css">
  <link rel="stylesheet" href="../static/bootstrap-table/bootstrap-table.css">
  <script src="../static/jquery/jquery-3.6.0.js"></script>
  <script src="../static/bootstrap/js/bootstrap.js"></script>
  <script src="../static/bootstrap-table/bootstrap-table.js"></script>
  <script src="../static/bootstrap-table/locale/bootstrap-table-zh-CN.js"></script>
  <!---->
  <link rel="stylesheet" href="https://s3-us-west-2.amazonaws.com/colors-css/2.2.0/colors.min.css">
</head>
<body>


<table
  id="table"
  data-toggle="table"
  data-url="../json/data1.json">
  <thead>
  <tr>
    <th data-field="id">ID</th>
    <th data-field="name" data-cell-style="cellStyle">Item Name</th>
    <th data-field="price">Item Price</th>
  </tr>
  </thead>
</table>

<script>
  function cellStyle(value, row, index) {
    var classes = [
      'bg-blue',
      'bg-green',
      'bg-orange',
      'bg-yellow',
      'bg-red'
    ]

    if (index % 2 === 0 && index / 2 < classes.length) {
      return {
        classes: classes[index / 2]
      }
    }
    return {
      css: {
        color: 'blue'
      }
    }
  }
</script>
</body>
</html>
